//
//  NavigationViewController.m
//  DropDownListProject
//
//  Created by 花若似相离 on 2018/3/15.
//  Copyright © 2018年 YangYang. All rights reserved.
//

#import "NavigationViewController.h"

@interface NavigationViewController ()

@end

@implementation NavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSDictionary *textAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]};
    [self.navigationBar setTitleTextAttributes:textAttributes];
    //改变navBar的背景颜色
    [self.navigationBar setBarTintColor:[UIColor colorWithHexString:@"#2B74CE"]];
    self.navigationBar.tintColor = [UIColor whiteColor];
    
    
    
    
    //可以设置一些样式
    /*
     //设置了NO之后View自动下沉navigationBar的高度
     self.navigationBar.translucent = NO;
     //改变左右Item的颜色
     self.navigationBar.tintColor = [UIColor whiteColor];
     
     //改变title的字体样式
     NSDictionary *textAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName: FONT_SYSTEM_BOLD(18)};
     [self.navigationBar setTitleTextAttributes:textAttributes];
     //改变navBar的背景颜色
     [self.navigationBar setBarTintColor:[UIColor blueColor]];
     */
}

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if ([self.viewControllers count] > 0){
        viewController.hidesBottomBarWhenPushed = YES;
        //可以在这里定义返回按钮等
        /*
         UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_back"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
         viewController.navigationItem.leftBarButtonItem = backItem;
         */
    }
    //一定要写在最后，要不然无效
    [super pushViewController:viewController animated:animated];
    CGRect rect = self.tabBarController.tabBar.frame;
    rect.origin.y = [UIScreen mainScreen].bounds.size.height - rect.size.height;
    self.tabBarController.tabBar.frame = rect;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
